import { mergeRsbuildConfig, getBaseConfig, extendConfig, type RsbuildConfig } from "../../index";

/**
 * 生成rsbuild配置
 */
const mkRsbuildConfig = () => mergeRsbuildConfig(
  getBaseConfig({
    rsbuildConfig:{
      dev: {
        progressBar: true,
      },
      server:{
        port: 3001
      }
    },
  }),
  getTailwindConfig(),
  extendConfig.getBabelConfig({styledJsxEnabled: false}),
  extendConfig.getNodePolyfillConfig({
    cesiumEngine:{
      options:{
        srcDirPath: '../vendor/node_modules/@cesium/engine', 
        distDirPath: "static"
      }
    }
  }),
);

/**
 * 获取tailwindcss配置
 */
const getTailwindConfig = (): RsbuildConfig => {
  return {
    tools: {
      postcss: (opts, { addPlugins }) => {
        // 配置Tailwindcss v3
        // addPlugins(require("tailwindcss"))

        // 配置Tailwindcss v4
        addPlugins(require("@tailwindcss/postcss"))
      },
    },
  }
}


export default mkRsbuildConfig();



